<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org">
<head>
    <th:block th:include="include :: header('领养订单详情')"/>
    <style>
        .lable {
            display: flex;
            margin-top: 20px;
            align-items: baseline;
        }

        .tabledata {
            margin-top: 5px;
        }

        .search-collapse, .select-table {
            width: 100% !important;
            border-radius: 0px !important;
            margin-top: -20px !important;
            padding-top: 0px !important;
            padding-bottom: 0px !important;
            box-shadow: 0 0 0 0 !important;
        }
    </style>
</head>
<div style="padding: 30px" th:object="${wxOrder}">
    <input id="orderId" th:value="*{orderId}" type="hidden">
    <input id="orderState" th:value="*{orderState}" type="hidden">
    <div id="printDiv">
        <h4 class="form-header h4">基本信息</h4>
        <div class="tabledata">
            <div class="table-responsive">
                <table class="table table-bordered table-striped">
                    <thead>
                    <tr>
                        <th>订单编号</th>
                        <th>领养方式</th>
                        <th>领养人</th>
                        <th>领养状态</th>
                        <th>领养时间</th>
                    </tr>
                    </thead>
                    <tbody>
                    <tr>
                        <td th:text="*{orderNo}"></td>
                        <td th:text="${@dict.getLabel('order_type', wxOrder.orderType)}"></td>
                        <td>
                            <span th:text="*{userName}"></span>
                        </td>
                        <td th:text="${@dict.getLabel('order_state', wxOrder.orderState)}"></td>
                        <td th:text="*{#dates.format({orderTime},'yyyy-MM-dd HH:mm:ss')}"></td>
                    </tr>
                    <tr>
                        <th>归属农场</th>
                        <th>联系人</th>
                        <th>家禽品种</th>
                        <th>出栏状态</th>
                        <th>当前重量</th>
                    </tr>
                    <tr>
                        <td th:text="*{farmName}"></td>
                        <td>
                            <span th:text="*{farmWorkName}"></span>
                            （<span th:text="*{farmWorkPhone}"></span>）
                        </td>
                        <td th:text="${wxOrder.wxPoultry.poultryName}"></td>
                        <td th:text="${@dict.getLabel('poultry_slaughter_state', wxOrder.wxPoultry.poultrySlaughterState)}"></td>
                        <td th:text="${wxOrder.wxPoultry.poultryKg}"></td>
                    </tr>
                    <tr>
                        <th>领养定金</th>
                        <th>每日饲料费</th>
                        <th>管理费用</th>
                        <th>已付饲料费</th>
                        <th>待付饲料费</th>
                    </tr>
                    <tr>
                        <td><span th:text="*{orderFee}"></span><span>（已付）</span></td>
                        <td th:text="${wxOrder.wxPoultry.poultryDayFee}"></td>
                        <td>
                            <span th:text="${wxOrder.wxPoultry.poultryAdminFee}"></span>
                            <span th:if="${wxOrder.orderState==0}">（未付）</span>
                            <span th:if="${wxOrder.orderState>0}">（已付）</span>
                        </td>
                        <td th:text="${wxOrder.orderIsdayfee}"></td>
                        <td th:text="${wxOrder.orderNodayfee}"></td>
                    </tr>
                    <tr th:if="${wxOrder.orderType==0}">
                        <th>联系人</th>
                        <th colspan="3">邮寄地址</th>
                        <th>快递单号</th>
                    </tr>
                    <tr th:if="${wxOrder.orderType==0}">
                        <td>
                            <span th:text="*{orderName}"></span>
                            （<span th:text="*{orderPhone}"></span>）
                        </td>
                        <td colspan="3">
                            <span th:text="*{orderHost}"></span>
                        </td>
                        <td th:text="*{fastMail}"></td>
                    </tr>
                    <tr th:if="${wxOrder.orderType==1}">
                        <th>门店名称</th>
                        <th th:text="*{canteenName}"></th>
                        <th>联系人</th>
                        <th colspan="3">
                            <span th:text="*{canteenWorker}"></span>
                            （<span th:text="*{canteenPhone}"></span>）
                        </th>
                    </tr>
                    </tbody>
                </table>
            </div>
        </div>
        <h4 class="form-header h4">子支付订单明细</h4>
        <div class="col-sm-12 select-table table-striped">
            <table id="bootstrap-table"></table>
        </div>

        <div th:if="${wxOrder.orderType==1}">
            <h4 class="form-header h4">预约加工记录</h4>
            <div class="col-sm-12 select-table table-striped">
                <table id="bootstrap-table-1"></table>
            </div>
        </div>
    </div>
</div>
<th:block th:include="include :: footer"/>
<script th:inline="javascript">
    initChildOrder()
    function initChildOrder() {
        var orderChildTypeDatas = [[${@dict.getType('order_child_type')}]];
        var prefix = ctx + "wechat/WxOrderChild";
        var options = {
            url: prefix + "/list?orderChildOid=" + $("#orderId").val(),
            modalName: "子订单管理",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            columns: [
                {
                    field: 'orderChildId',
                    title: '编号',
                    visible: false,
                    sortable: false
                },
                {
                    field: 'orderChildNo',
                    title: '支付单号',
                    sortable: false
                },
                {
                    field: 'orderChildType',
                    title: '订单类型',
                    formatter: function (value, row, index) {
                        return $.table.selectDictLabel(orderChildTypeDatas, value);
                    }
                },
                {
                    field: 'orderChildFee',
                    title: '订单金额',
                    sortable: false
                },
                {
                    field: 'orderChildTime',
                    title: '创建时间',
                    sortable: false
                }]
        };
        $.table.init(options);
    }
    initOrderpre()
    function initOrderpre(){
        var removeFlag = [[${@permission.hasPermi('wechat:WxOrderPre:remove')}]];
        var orderPreStateDatas = [[${@dict.getType('order_pre_state')}]];
        var prefix = ctx + "wechat/WxOrderPre";

        var options = {
            id: "bootstrap-table-1",
            url: prefix + "/list?orderPreOid="+$("#orderId").val(),
            removeUrl: prefix + "/remove",
            modalName: "预约加工订单",
            showSearch: false,
            showRefresh: false,
            showToggle: false,
            showColumns: false,
            columns: [
                {
                    field: 'orderPreId',
                    title: '编号',
                    visible: false,
                    sortable: false
                },
                {
                    field: 'orderPreName',
                    title: '联系人',
                    sortable: false
                },
                {
                    field: 'orderPrePhone',
                    title: '联系电话',
                    sortable: false
                },
                {
                    field: 'orderPreIstime',
                    title: '到店时间',
                    sortable: false
                },
                {
                    field: 'orderPreRemark',
                    title: '加工备注',
                    sortable: false
                },
                {
                    field: 'orderPreKg',
                    title: '本次加工重量',
                    sortable: false
                },
                {
                    field: 'orderPreState',
                    title: '预约状态',
                    formatter: function(value, row, index) {
                        return $.table.selectDictLabel(orderPreStateDatas, value);
                    }
                },
                {
                    field: 'orderPreTime',
                    title: '预约时间',
                    sortable: false
                },
                {
                    title: '操作',
                    align: 'center',
                    formatter: function(value, row, index) {
                        var actions = [];
                        actions.push('<a class="btn btn-xs ' + removeFlag + '" href="javascript:void(0)" onclick="$.operate.remove(\'' + row.orderPreId + '\')">删除</a>');
                        return actions.join('');
                    }
                }]
        };
        $.table.init(options);
    }

</script>
</body>
</html>
